package com.yxh.www.author.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author Yangxiaohui
 * @since 2020-05-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
public class SmUser extends Model<SmUser> {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    /**
     * 用户名
     */
    @TableField("user_name")
    private String userName;

    /**
     * 手机号码
     */
    @TableField("user_phone")
    private String userPhone;

    /**
     * 登录密码
     */
    @TableField("login_pass")
    private String loginPass;

    /**
     * 用户头像
     */
    @TableField("user_photo")
    private String userPhoto;

    /**
     * 用户邮箱
     */
    @TableField("user_mail")
    private String userMail;

    /**
     * 用户状态（0：正常；1：失效）
     */
    @TableField("user_status")
    private String userStatus;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 最后登陆时间
     */
    @TableField("last_login_time")
    private LocalDateTime lastLoginTime;

    public SmUser(String userName, String userPhone, String loginPass, String userPhoto, String userMail) {
        this.userName = userName;
        this.userPhone = userPhone;
        this.loginPass = loginPass;
        this.userPhoto = userPhoto;
        this.userMail = userMail;
    }

    public SmUser(String id, String userName, String userPhone, String loginPass, String userPhoto, String userMail) {
        this.id = id;
        this.userName = userName;
        this.userPhone = userPhone;
        this.loginPass = loginPass;
        this.userPhoto = userPhoto;
        this.userMail = userMail;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
